﻿using Architecture.API.Application.Command.RoleCommand;
using Architecture.Domain;
using Architecture.Domain.Service.RoleServices;
using MediatR;

namespace Architecture.API.Application.CommandHandlers.RoleHandler
{
    public class RoleReverseCommandHandler : IRequestHandler<RoleReverseCommand, Role>
    {
        /// <summary>
        /// 角色数据服务
        /// </summary>
        private readonly IRoleService _roleService;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="roleService">角色数据服务</param>
        public RoleReverseCommandHandler(IRoleService roleService)
        {
            _roleService = roleService;
        }

        public async Task<Role> Handle(RoleReverseCommand request, CancellationToken cancellationToken)
        {
            return await _roleService.GetModelById(request.RoleId);
        }
    }
}
